//
//  DHButtonCell.m
//  宏达APP
//
//  Created by DIANGHONG on 2018/5/5.
//  Copyright © 2018年 123. All rights reserved.
//

#import "DHButtonCell.h"
#import "DHButton.h"
@interface DHButtonCell()
@property (weak, nonatomic) IBOutlet DHButton *classifyButton;

@end

@implementation DHButtonCell

- (void)setPlanList:(DHPlanList *)planList{
    _planList = planList;
    
    if (!planList) {return;}
    [self.classifyButton setTitle:planList.plan_name forState:UIControlStateNormal];
    self.classifyButton.planList = planList;
//    if ([_planList.plan_name isEqualToString:@"电脑攒机"]) {
//        [self.delegate buttonCellClick:self sender:self.classifyButton];
//          //self.classifyButton.selected = YES;
//    }
 
}

- (void)setClassModel:(DHClassModel *)classModel{
    _classModel = classModel;
    if (!classModel) {return;}
    [self.classifyButton setTitle:classModel.gc_name forState:UIControlStateNormal];
    self.classifyButton.classModel = classModel;
//    if ([_classModel.gc_name isEqualToString:@"内存条"]) {
//        [self.delegate buttonCellClick:self sender:self.classifyButton];
//        
//    }
}

- (void)awakeFromNib{
    [super awakeFromNib];
    
    
    
}


- (void)layoutSubviews{
    [super layoutSubviews];
    [self setupUI];

}

// 设置界面
- (void)setupUI{
    
    [self.classifyButton setTitleColor:UIColor.lightGrayColor forState:UIControlStateNormal];
    [self.classifyButton setTitleColor:UIColor.whiteColor forState:UIControlStateSelected];
    [self.classifyButton setBackgroundImage:[UIImage imageNamed:@"buttonBgImageNor"] forState:UIControlStateNormal];
    [self.classifyButton setBackgroundImage:[UIImage imageNamed:@"buttonBgImageSelected"] forState:UIControlStateSelected];
    [self.classifyButton addTarget:self action:@selector(classifyButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)classifyButtonClick:(UIButton *)sender{
   
    [self.delegate buttonCellClick:self sender:sender];
}
@end
